import 'package:tender_flutter/page/home/model/company_entity.dart';

companyEntityFromJson(CompanyEntity data, Map<String, dynamic> json) {
	if (json['pageNum'] != null) {
		data.pageNum = json['pageNum'] is String
				? int.tryParse(json['pageNum'])
				: json['pageNum'].toInt();
	}
	if (json['pageSize'] != null) {
		data.pageSize = json['pageSize'] is String
				? int.tryParse(json['pageSize'])
				: json['pageSize'].toInt();
	}
	if (json['total'] != null) {
		data.total = json['total'] is String
				? int.tryParse(json['total'])
				: json['total'].toInt();
	}
	if (json['pages'] != null) {
		data.pages = json['pages'] is String
				? int.tryParse(json['pages'])
				: json['pages'].toInt();
	}
	if (json['list'] != null) {
		data.xList = new List<CompanyList>();
		(json['list'] as List).forEach((v) {
			data.xList.add(new CompanyList().fromJson(v));
		});
	}
	if (json['isFirstPage'] != null) {
		data.isFirstPage = json['isFirstPage'];
	}
	if (json['isLastPage'] != null) {
		data.isLastPage = json['isLastPage'];
	}
	return data;
}

Map<String, dynamic> companyEntityToJson(CompanyEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['pageNum'] = entity.pageNum;
	data['pageSize'] = entity.pageSize;
	data['total'] = entity.total;
	data['pages'] = entity.pages;
	if (entity.xList != null) {
		data['list'] =  entity.xList.map((v) => v.toJson()).toList();
	}
	data['isFirstPage'] = entity.isFirstPage;
	data['isLastPage'] = entity.isLastPage;
	return data;
}

companyListFromJson(CompanyList data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id'] is String
				? int.tryParse(json['id'])
				: json['id'].toInt();
	}
	if (json['companyCode'] != null) {
		data.companyCode = json['companyCode'].toString();
	}
	if (json['regMoney'] != null) {
		data.regMoney = json['regMoney'].toString();
	}
	if (json['address'] != null) {
		data.address = json['address'].toString();
	}
	if (json['companyType'] != null) {
		data.companyType = json['companyType'].toString();
	}
	if (json['issueTime'] != null) {
		data.issueTime = json['issueTime'].toString();
	}
	if (json['companyName'] != null) {
		data.companyName = json['companyName'].toString();
	}
	if (json['regOrgName'] != null) {
		data.regOrgName = json['regOrgName'].toString();
	}
	if (json['businessStatus'] != null) {
		data.businessStatus = json['businessStatus'].toString();
	}
	if (json['faRen'] != null) {
		data.faRen = json['faRen'].toString();
	}
	if (json['bussinessDes'] != null) {
		data.bussinessDes = json['bussinessDes'].toString();
	}
	if (json['regM'] != null) {
		data.regM = json['regM'].toString();
	}
	if (json['regNumber'] != null) {
		data.regNumber = json['regNumber'].toString();
	}
	if (json['areaCode'] != null) {
		data.areaCode = json['areaCode'].toString();
	}
	if (json['creditCode'] != null) {
		data.creditCode = json['creditCode'].toString();
	}
	if (json['areaName'] != null) {
		data.areaName = json['areaName'].toString();
	}
	if (json['companyKey'] != null) {
		data.companyKey = json['companyKey'].toString();
	}
	if (json['provinceName'] != null) {
		data.provinceName = json['provinceName'].toString();
	}
	if (json['regType'] != null) {
		data.regType = json['regType'].toString();
	}
	if (json['title'] != null) {
		data.title = json['title'].toString();
	}
	if (json['isFocus'] != null) {
		data.isFocus = json['isFocus'];
	}
	return data;
}

Map<String, dynamic> companyListToJson(CompanyList entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['companyCode'] = entity.companyCode;
	data['regMoney'] = entity.regMoney;
	data['address'] = entity.address;
	data['companyType'] = entity.companyType;
	data['issueTime'] = entity.issueTime;
	data['companyName'] = entity.companyName;
	data['regOrgName'] = entity.regOrgName;
	data['businessStatus'] = entity.businessStatus;
	data['faRen'] = entity.faRen;
	data['bussinessDes'] = entity.bussinessDes;
	data['regM'] = entity.regM;
	data['regNumber'] = entity.regNumber;
	data['areaCode'] = entity.areaCode;
	data['creditCode'] = entity.creditCode;
	data['areaName'] = entity.areaName;
	data['companyKey'] = entity.companyKey;
	data['provinceName'] = entity.provinceName;
	data['regType'] = entity.regType;
	data['title'] = entity.title;
	data['isFocus'] = entity.isFocus;
	return data;
}